home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / powervww / thide.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-05  |  2.0 KB  |  78 lines

  1. //  ____________________________________________________
  2. // |                                                    |
  3. // |  Project:     POWER VIEW IDE                       |
  4. // |  File:        THIDE.CPP                            |
  5. // |  Compiler:    WPP386 (10.6)                        |
  6. // |                                                    |
  7. // |  Subject:     Thide_on_close class implementation  |
  8. // |                                                    |
  9. // |  Author:      Emil Dotchevski                      |
  10. // |____________________________________________________|
  11. //
  12. // E-mail: zajo@geocities.com
  13. // URL:    http://www.geocities.com/SiliconValley/Bay/3577
  14.  
  15. #define uses_cmdgen
  16. #define uses_table
  17. #include "PVUSES.H"
  18.  
  19. #define _DECLARE_THIDE_H
  20.   #include "THIDE.H"
  21. #undef  _DECLARE_THIDE_H
  22.  
  23.  
  24. /*
  25. public
  26. */
  27.   Thide_on_close::Thide_on_close( int _xl, int _yl ):
  28.     Tlist_iterator( _xl, _yl )
  29.   {
  30.     set_flags( tfDOUBLE_CLICK_OK, 1 );
  31.   }
  32.  
  33.   void Thide_on_close::set_state( uint _state_word, char enable )
  34.   {
  35.     Titem *window;
  36.  
  37.     Tlist_iterator::set_state( _state_word, enable );
  38.     if( owner==NULL || ((window=owner->owner)==NULL) ) return;
  39.     if( _state_word&isHIDDEN )
  40.     {
  41.       window->set_state( isHIDDEN, enable );
  42.       if( enable )
  43.       {
  44.         if( window->state( isSELECTED ) ) window->owner->tab_next( -1 );
  45.         if( window->state( isSELECTED ) ) window->set_state( isSELECTED, 0 );
  46.       }
  47.       else
  48.       {
  49.         window->set_state( isSELECTED, 0 );
  50.         focus();
  51.       }
  52.     }
  53.   }
  54.  
  55.   boolean Thide_on_close::valid( uint command )
  56.   {
  57.     if( command == cmDONE )
  58.     {
  59.       set_state( isHIDDEN, 1 );
  60.       return 0;
  61.     }
  62.     return Tlist_iterator::valid( command );
  63.   }
  64.  
  65.  
  66. /*
  67. protected
  68. */
  69.   void Thide_on_close::event_handler( Tevent &ev )
  70.   {
  71.     Tlist_iterator::event_handler( ev );
  72.     if( ev.code==evKEY_PRESS && ev.ASCII==kESC && state(isFOCUSED) )
  73.     {
  74.       put_command( this, cmDONE );
  75.       handled( ev );
  76.     }
  77.   }
  78.